
import cgi
import webapp2

from google.appengine.api import users

class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.out.write("HEY THERE CAMPER!")



    def post(self):
        #file = open("bounds.txt", "w")
        if self.request.get('fileLine') == 'done':
           self.response.headers['Content-Type'] = 'text/plain'
           self.response.out.write("")
           self.response.out.write("done")
        #else:
           #file.write(self.request.get('fileLine'))
           #file.close()
   


app = webapp2.WSGIApplication([('/', MainPage)],
                              debug=True)
   
#app = webapp2.WSGIApplication([('/', MainPage),
#                              ('/sign', Guestbook)],
#                              debug=True)


#import cgi
#import webapp2

#from google.appengine.api import users

#class MainPage(webapp2.RequestHandler):
#  def get(self):

#      user = users.get_current_user()
#     

#      if user:
#          self.response.headers['Content-Type'] = 'text/plain'
#          self.response.out.write('Hello, ' + user.nickname() + '\n')

#          form = cgi.FieldStorage()
#          value = form.getlist("line")
#          fileData = "\n".join(value)
#          self.response.out.write(fileData)

#      else:
#          self.redirect(users.create_login_url(self.request.uri))

#      self.response.headers['Content-Type'] = 'text/plain'
#      self.response.out.write('Hello, webapp World! \n')
#      self.response.out.write('...As I usually say')

#app = webapp2.WSGIApplication([('/', MainPage)],
#                              debug=True)


#file = open("datafile.txt", "r")
#filedata = file.read()
#file.close()

#newLine = "Your new line of data with the time stamp goes here.\n" + filedata
#file = open("datafile.txt", "w")
#file.write(newLine)
#file.close()